{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4.0\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "# 创建数据流图：y = W * x + b，其中W和b为存储节点，x为数据节点。\n",
    "x = tf.placeholder(tf.float32)\n",
    "W = tf.Variable(1.0)\n",
    "b = tf.Variable(1.0)\n",
    "y = W * x + b\n",
    "with tf.Session() as sess:\n",
    "    tf.global_variables_initializer().run() # Operation.run\n",
    "    fetch = y.eval(feed_dict={x: 3.0})      # Tensor.eval\n",
    "    print(fetch)                            # fetch = 1.0 * 3.0 + 1.0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "venv",
   "language": "python",
   "name": "venv"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
